<template>
  <div class="title">
    <div class="index-header" v-show="indexTitle">
      <router-link active-class="active" tag="span" to="list" class="iconfont icon-gengduo-2 list"></router-link>
      <div class="center" @click="serach">
        <span class="iconfont icon-fangdajing"></span>
        <span class="name">请输入宝贝名称</span>
      </div>
      <router-link active-class="active" tag="span" to="login" class="login">登录</router-link>
    </div>
     <div class="list-header" v-show="listTitle">
        <span class="iconfont icon-jiantou3"></span>
        <router-link tag="span" to="/serach" class="name">请输入宝贝名称</router-link>
    </div>

     <div class="detail-header" v-show="detailTitle">
        <span class="iconfont icon-jiantou3" @click="GoIndex"></span>
         <slot name="detail" class="detail-contail"></slot>
         <span class="iconfont icon-gouwuche"></span>
    </div>
    
    <div class="text-header" v-show="textTitle">
         <slot name="texts"></slot>
    </div>
  </div>
</template>

<script>
import{mapState} from 'vuex'
export default {
  components: {},
  methods: {
    serach() {
      this.$router.push("/search");
    },
    GoIndex(){
      this.$router.push("/index")
    }
  },
  components:{
  },
  computed: {
      ...mapState('title',['indexTitle','listTitle','detailTitle','textTitle']),
      
  },
};
</script>
<style lang="scss" scoped>
.title {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;

}
.list-header,.index-header,.text-header,.detail-header{
     height: 5rem;
  text-align: center;
  line-height: 5rem;
}
.index-header {
  background: coral;
  display: flex;
  padding: 0 10px;
  justify-content: space-between;
  align-items: center;
 
  span {
    color: white;
  }
  .list {
    width: 20px;
  }
  .login {
    width: 60px;
  }
  .center {
    flex: 1;
    margin: 0 2rem;
    height: 3rem;
    background: rgba($color: #000000, $alpha: 0.2);
    border-radius: 8px;
    line-height: 3rem;
    span {
      font-size: 1.5rem;
    }
    .iconfont {
      font-size: 1.8rem;
      display: inline-block;
      padding: 0 5px;
    }
  }
  .active {
    color: red;
  }
}

.list-header{
    display: flex;
    padding: 0 5px;
    align-items: center;
    .iconfont{
        width: 3rem;
        padding-right: 20px;
    }
    .name{
        width: 76%;
        border-radius: 10px;
        height: 3.7rem;
        line-height: 3.7rem;
        font-size: 1.4rem;
        border: 1px slategrey solid;
    }
}
.text-header{
    border-bottom: 1px silver solid;
}
.detail-header{
    display: flex;
    padding:0 15px;
    justify-content: space-between;
    .iconfont{
        padding:0 8px;
        font-size: 2.6rem;
    }
        .detail-contail{
            flex: 1;
            background: silver;
            margin:0 5px;
        }
}

</style>